﻿<UserControl x:Class="Common.Controls.Controls.DataPager"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Common.Controls.Controls"
             mc:Ignorable="d" 
             x:Name="dataPager"
             >
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Common.Dialogs;component/Styles/CommonStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <DataTemplate x:Key="PageTemplate">
                <Grid>
                    <Button Height="18" Width="18" Click="Button_Click" Margin="1"
                                    Style="{StaticResource PageButtonStyle}" Cursor="Hand"
                                    >
                        <Button.Content>
                            <TextBlock Text="{Binding DisplayName}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Button.Content>
                    </Button>
                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Border BorderBrush="LightBlue" Background="Lavender" BorderThickness="2" CornerRadius="6">
            <StackPanel Orientation="Horizontal" Margin="6" >
                <Button x:Name="PrevTenPagesButton" Click="PrevTenPagesButton_Click" Cursor="Hand"
                    Style="{StaticResource ToolbarImageButtonStyle}" ToolTip="Move ten pages backward">
                    <Button.Content>
                        <Image Source="/Common.Dialogs;component/Images/DoubleLeftArrowHS.png" Width="16" Height="16"/>
                    </Button.Content>
                </Button>
                <Button x:Name="PrevPageButton" Click="MovePreviousPage_Click" Cursor="Hand"
                    Style="{StaticResource ToolbarImageButtonStyle}" ToolTip="Move page backward">
                    <Button.Content>
                        <Image Source="/Common.Dialogs;component/Images/LeftArrowHS.png" Width="16" Height="16"/>
                    </Button.Content>
                </Button>
                <ListView x:Name="PageSelectorListView" 
                      ItemsSource="{Binding ElementName=dataPager,Path=Pages}"
                      ItemTemplate="{StaticResource PageTemplate}"
                      Style="{StaticResource BorderlessListView}"
                      ItemContainerStyle="{StaticResource PageListViewItemStyle}"
                      >
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal"></StackPanel>
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                </ListView>
                <Button Content="..." Height="18" Width="18" Margin="1"
                        Style="{StaticResource MorePageButtonStyle}"
                        Visibility="{Binding ElementName=dataPager,Path=MoreItemsPlaceholderVisibility}"
                        VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
                        />
                <Button x:Name="NextPageButton" Click="MoveNextPage_Click" Cursor="Hand"
                    Style="{StaticResource ToolbarImageButtonStyle}" ToolTip="Move page forward">
                    <Button.Content>
                        <Image Source="/Common.Dialogs;component/Images/RightArrowHS.png" Width="16" Height="16"/>
                    </Button.Content>
                </Button>
                <Button x:Name="NextTenPagesButton" Click="NextTenPagesButton_Click" Cursor="Hand"
                    Style="{StaticResource ToolbarImageButtonStyle}" ToolTip="Move ten pages forward">
                    <Button.Content>
                        <Image Source="/Common.Dialogs;component/Images/DoubleRightArrowHS.png" Width="16" Height="16"/>
                    </Button.Content>
                </Button>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
